package com.szmirren.entity.ams;

import com.szmirren.common.StringUtil;

import java.io.File;

/**
 * @author Lin
 * @date 2018/5/30
 */
public class ControlInfo {
    private static final String SRC_SECTION = "src.path";

    private String packageName;

    private String packagePath;

    private String boName;

    private String beanName;

    private String ivalueName;

    public ControlInfo(String basePackageName, GenItem item,String srcHome) {
        this.packageName = basePackageName + "." + item.getModelName();
//        String centerName = item.getCenterName();
//        String srcHome = GenConfig.getProperty(SRC_SECTION, centerName);
        String[] paths = StringUtil.split(packageName, '.');
        this.packagePath = srcHome + File.separator + StringUtil.join(paths, File.separator);
        this.boName = item.getBoName();
        this.beanName = boName + "Bean";
        this.ivalueName = 'I' + boName + "Value";
    }

    public String getPackageName() {
        return packageName;
    }
    public String getPackagePath() {
        return packagePath;
    }

    public String getBOPackageName() {
        return packageName + ".bo";
    }
    public String getBOPackagePath() {
        return packagePath + File.separator + "bo";
    }

    public String getIValuesPackageName() {
        return packageName + ".ivalues";
    }
    public String getIValuesPackagePath() {
        return packagePath + File.separator + "ivalues";
    }

    public String getIValuesPath() {
        return getIValuesPackagePath() + File.separator + ivalueName + ".java";
    }

    public String getBOPath() {
        return getBOPackagePath() + File.separator + boName + ".bo";
    }

    public String getBOBeanPath() {
        return getBOPackagePath() + File.separator + beanName + ".java";
    }




    public String getBoName() {
        return boName;
    }

    public String getBeanName() {
        return beanName;
    }

    public String getIValueName() {
        return ivalueName;
    }
}
